package com.qingke.ssh.dao;

import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.qingke.ssh.bean.EmployeeLogin;
import com.qingke.ssh.bean.StudentLogin;

@Repository
public class StudentDao {
	@Autowired
	private HibernateManager hibernateManager;

	public StudentLogin login(String username, String password) {
		System.out.println(hibernateManager);

		Query<StudentLogin> query = hibernateManager.getSession()
				.createQuery("from StudentLogin where code='" + username + "' and password = '" + password + "'");
		System.out.println(query.getResultList().size());
		if (query.getResultList().size() == 0) {
			return null;
		}
		return query.getResultList().get(0);
	}
}
